package com.example.anew.journey.mynewjourney.factory;

import android.support.v4.app.Fragment;

import com.example.anew.journey.mynewjourney.logic.fragment.EquipmentFragment;
import com.example.anew.journey.mynewjourney.logic.fragment.MeFragment;

import java.util.HashMap;

/**
 * 杭州惟君医疗科技有限公司15
 * Created by 20433 on 2018/3/7
 */

public class MainFragmentFactory {
    private static final int EQUIPMENT = 0; //equipment
    private static final int ME = 1;
    private static HashMap<Integer, Fragment> mapAll = new HashMap();

    public static Fragment CreateCircleObject(int position) {
        Fragment fragment = mapAll.get(position);
        if (fragment == null) {
            switch (position) {
                case EQUIPMENT:
                    fragment = new EquipmentFragment();
                    break;
                case ME:
                    fragment = new MeFragment();
                    break;
            }
            mapAll.put(position, fragment);
            return fragment;
        }
        return fragment;
    }
}
